A
You have run into a problem with the Dialog Manager's support of 'ictb'.
The Dialog Manager forgets to reset some of the fields of the TextEdit
record when it swaps the font and font size information stored in the
'ictb'. You need to reset the fontAscent and lineHeight fields of the
TextEdit Record to match the size of the font specified in the 'ictb'. By
default those fields are set to the lineHeight and fontAssent of 12 point
Chicago.
Below is code that shows how to set up the TextEdit record.
//------------------------------------------------------------------ static void SetUpEditField (DialogRef dlog,short fontNum,short fontSize) //------------------------------------------------------------------ { FontInfo info; DialogPeek dpeek = (DialogPeek)dlog; if (dpeek != nil) { TEHandle te = dpeek->textH; //get the TEHandle if (te != nil) { short oldFont = dlog->txFont; //save old info short oldSize = dlog->txSize; TextFont(fontNum); //set the port to correct font info TextSize(fontSize); GetFontInfo(&info); // ok lets fix the TE record since the dialog manager left it at 12 point te[0]->txFont = fontNum; // set font te[0]->txSize = fontSize; te[0]->lineHeight = info.ascent + info.descent + info.leading; //calculate the correct info te[0]->fontAscent = info.ascent ; TextFont(oldFont); //reset the font info TextSize(oldSize); } } } //------------------------------------------------------------------ static short DoDialog(short resID) //------------------------------------------------------------------ { DialogRef dlog; GrafPtr oldPort; short itemHit = 0; GetPort(&oldPort); dlog = GetNewDialog(resID,nil,(WindowRef)-1); if (dlog) { SetPort(dlog); SelectDialogItemText(dlog,2,0x8000,0x8000); //set the cursor SetUpEditField(dlog,geneva,10); // set the edit field (void)SetDialogDefaultItem(dlog,1); // hilight the ok button ShowWindow(dlog); // show the dialog while (itemHit != ok) { ModalDialog(nil,&itemHit); } SetPort(oldPort); DisposeDialog(dlog); } return itemHit; }